﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WikiDoc
{
    /// <summary>
    /// a horizon line
    /// </summary>
    public class HorizonLine : WikiLine
    {

        private int _Level;
        /// <summary>
        /// Gets or sets the level.
        /// </summary>
        /// <value>The level.</value>
        public int Level
        {
            get { return _Level; }
        }


        /// <summary>
        /// 初始化 <see cref="HorizonLine"/> 类的新实例.
        /// </summary>
        /// <param name="line"></param>
        /// <param name="level"></param>
        public HorizonLine(string line, int level) : base(LineType.HorizonLine, line)
        {
            ResetAs(line, level);
        }

        /// <summary>
        /// Resets as.
        /// </summary>
        /// <param name="line">The line.</param>
        /// <param name="level">The level.</param>
        public HorizonLine ResetAs(string line, int level)
        {
            if (line == null) throw new ArgumentNullException("line");
            if (level <= 0)
            {
                throw new ArgumentOutOfRangeException("level", level, "level 必须大于 0");
            }

            Line = line;
            _Level = level;

            return this;
        }
    }
}
